package com.qianda.qdminiapp.common.util;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;

/**
 * @ClassName JsonUtils
 * @Author cw
 * @Date 2019/8/6 15:37
 * @Version 1.0
 */
public class JsonUtils {
    private JsonUtils() {
    }

    public static String toJson(Object data) {
        return JSON.toJSONString(data, SerializerFeature.WriteMapNullValue);
    }

    public static <T> T fromJson(String json, Class<T> type) {
        return JSON.parseObject(json, type);
    }
}
